testsuite/gtk/defaultvalue: Actually build...& fix
authorDaniel Boles <dboles.src@gmail.com>
Fri, 29 Jun 2018 19:00:06 +0000 (20:00 +0100)
committerDaniel Boles <dboles.src@gmail.com>
Fri, 29 Jun 2018 19:05:21 +0000 (20:05 +0100)
It looks like this got dropped during the move from autotools and never
restored. I can see why, since making it work wasn't a hugely fun task!

Notes on some less then obvious details:
 * PlacesSidebar is private now and didn't seem to be to be particularly
   easy to adapt to, so this moves to checking for it by name, not TYPE.
   I couldn't find a (fast) better way; if you know how, please clean up
 * added 2 casts to avoid warnings from the new type-propagating ref()
 * GdkClipboard and GdkContentProvider need some properties dodged
 * GtkToolItemGroup is gone
 * fixed indentation and used TypeName:property-name syntax in a print()

testsuite/gtk/defaultvalue.c
testsuite/gtk/meson.build

index 3ae08508682966ccceb5eb9086a4ca1d7d798e07..4b559a0d237b1a2b4740df5848e90bc6ad1aefdb 100644 (file)
@@ -96,20 +96,20 @@ test_type (gconstpointer data)
   if (g_type_is_a (type, GTK_TYPE_FILE_CHOOSER_BUTTON) ||
       g_type_is_a (type, GTK_TYPE_FILE_CHOOSER_DIALOG) ||
       g_type_is_a (type, GTK_TYPE_FILE_CHOOSER_WIDGET) ||
-      g_type_is_a (type, GTK_TYPE_PLACES_SIDEBAR))
+      g_str_equal (g_type_name (type), "GtkPlacesSidebar"))
     return;
  
   klass = g_type_class_ref (type);
 
   if (g_type_is_a (type, GTK_TYPE_SETTINGS))
-    instance = g_object_ref (gtk_settings_get_default ());
+    instance = G_OBJECT (g_object_ref (gtk_settings_get_default ()));
   else if (g_type_is_a (type, GDK_TYPE_SURFACE))
     {
-      instance = g_object_ref (gdk_surface_new_popup (gdk_display_get_default (),
-                                                     0,
-                                                     &(GdkRectangle) { 0, 0, 100, 100 }));
+      instance = G_OBJECT (g_object_ref (gdk_surface_new_popup (display,
+                                                                &(GdkRectangle) { 0, 0, 100, 100 })));
     }
-  else if (g_str_equal (g_type_name (type), "GdkX11Cursor"))
+  else if (g_type_is_a (type, GDK_TYPE_CLIPBOARD) ||
+           g_str_equal (g_type_name (type), "GdkX11Cursor"))
     instance = g_object_new (type, "display", display, NULL);
   else
     instance = g_object_new (type, NULL);
@@ -129,6 +129,20 @@ test_type (gconstpointer data)
       if ((pspec->flags & G_PARAM_READABLE) == 0)
        continue;
 
+      if (g_type_is_a (type, GDK_TYPE_CLIPBOARD) &&
+         strcmp (pspec->name, "display") == 0)
+       continue;
+
+      /* These are set in init() */
+      if ((g_type_is_a (type, GDK_TYPE_CLIPBOARD) ||
+           g_type_is_a (type, GDK_TYPE_CONTENT_PROVIDER)) &&
+         strcmp (pspec->name, "formats") == 0)
+       continue;
+
+      if (g_type_is_a (type, GDK_TYPE_CONTENT_PROVIDER) &&
+         strcmp (pspec->name, "storable-formats") == 0)
+       continue;
+
       /* This one has a special-purpose default value */
       if (g_type_is_a (type, GTK_TYPE_DIALOG) &&
          (strcmp (pspec->name, "use-header-bar") == 0))
@@ -214,6 +228,15 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
            strcmp (pspec->name, "cell-area-context") == 0))
        continue;
 
+G_GNUC_END_IGNORE_DEPRECATIONS
+
+      /* This is set in init() */
+      if (g_type_is_a (type, GTK_TYPE_FONT_CHOOSER_WIDGET) &&
+          strcmp (pspec->name, "tweak-action") == 0)
+        continue;
+
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+
       if (g_type_is_a (type, GTK_TYPE_ICON_VIEW) &&
          (strcmp (pspec->name, "cell-area") == 0 ||
            strcmp (pspec->name, "cell-area-context") == 0))
@@ -295,10 +318,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS
           strcmp (pspec->name, "buffer") == 0)
         continue;
 
-      if (g_type_is_a (type, GTK_TYPE_TOOL_ITEM_GROUP) &&
-          strcmp (pspec->name, "label-widget") == 0)
-        continue;
-
       if (g_type_is_a (type, GTK_TYPE_TREE_VIEW) &&
          (strcmp (pspec->name, "hadjustment") == 0 ||
            strcmp (pspec->name, "vadjustment") == 0))
@@ -326,7 +345,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
         continue;
 
       /* show-desktop depends on desktop environment */
-      if (g_type_is_a (type, GTK_TYPE_PLACES_SIDEBAR) &&
+      if (g_str_equal (g_type_name (type), "GtkPlacesSidebar") &&
           strcmp (pspec->name, "show-desktop") == 0)
         continue;
 
@@ -341,11 +360,13 @@ G_GNUC_END_IGNORE_DEPRECATIONS
           strcmp (pspec->name, "adjustment") == 0)
         continue;
 
-
       if (g_test_verbose ())
-      g_print ("Property %s.%s\n",
-            g_type_name (pspec->owner_type),
-            pspec->name);
+        {
+          g_print ("Property %s:%s\n",
+                   g_type_name (pspec->owner_type),
+                   pspec->name);
+        }
+
       g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
       g_object_get_property (instance, pspec->name, &value);
       check_property ("Property", pspec, &value);
index d2febc485c8b15ecfca88ca4eaaf5287d8ab0e99..319eb14343905657a3ad0323da0525ce266ca09a 100644 (file)
@@ -17,6 +17,7 @@ tests = [
   ['cellarea'],
   ['check-icon-names'],
   ['cssprovider'],
+  ['defaultvalue'],
   ['entry'],
   ['firefox-stylecontext'],
   ['floating'],